/*************************************************************************************
*                                  SRL ENGINE                                        *
*                                                                                    *
*                                                                                    *
*  File : Program.h                                                                  *
*  Author: SRL Killing                                                               *
*  Date: 25/02/10 20:30                                                              *
*  Description:                                                                      *
*                                                                                    *  
*  Licence :  LGPL                                                                   *
*                                                                                    *
*    Copyright (C) 2010 Pecatte Baptiste                                             *
*                                                                                    *
*    This program is free software; you can redistribute it and/or                   *
*    modify it under the terms of the GNU Lesser General Public                      *
*    License as published by the Free Software Foundation; either                    *
*    version 2.1 of the License, or (at your option) any later version.              *
*                                                                                    *
*    This program is distributed in the hope that it will be useful,                 *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of                  *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                *
*    Lesser General Public License for more details.                                 *
*                                                                                    *
*    You should have received a copy of the GNU Lesser General Public                *
*    License along with this program; if not, write to the Free Software             *
*    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    *
*                                                                                    *
**************************************************************************************/

#ifndef DefineHeaderProgram
#define DefineHeaderProgram

namespace srl {
    
    #ifndef DefineHeaderShader
    class Shader;
    #endif

    class Program {
        public:
            Program();
            Program(srl::Shader* sh1=0, srl::Shader* sh2=0);
            ~Program();
            
            void Shader(srl::Shader *shader);
            void DShader(srl::Shader *shader);
            bool Link();
            bool IsLinked();
            void Use();
            std::string Log();
            
            static srl::Program* Current;
            static void DUse();
            static void Set(Program* currentProg);
            
            void Uniform(std::string var, float val);
            void Uniform(std::string var, int val);
            void Uniform(std::string var, float val1, float val2);
            void Uniform(std::string var, srl::Vector<float> val);
            void Uniform(std::string var, float val1, float val2, float val3, float val4);
            void Uniform(std::string var, int val1, int val2);
            void Uniform(std::string var, srl::Vector<int> val);
            void Uniform(std::string var, int val1, int val2, int val3, int val4);
            void Uniform(std::string var, srl::Matrix<float> val);
            void Uniform(std::string var, srl::Texture *val, int i);
            void Uniform(std::string var, srl::FrameBuffer *val, int i, int j);
            bool Uniform(std::string var, srl::FrameBuffer *val, int i);
            
            
        private:
            GLuint id;
            bool Linked;
    };
    
};

#endif
